package domain.entities;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import javax.persistence.*;
import java.util.*;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * MiembroBms entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "miembro_bms", catalog = "bms", uniqueConstraints = @UniqueConstraint(columnNames = "email"))
public class MiembroBms implements java.io.Serializable {

	// Fields

	private Integer id;
    private String bmsId;
    private String eclipseId;
    private String email;
	private String mobilePhone;
	private String name;
	private String phone;
	private String surname;
    private String dni;
    private Role role;
    private boolean projectLead;
    private boolean unboundedMonitor;
    private Set<Comentario> comentarios = new HashSet<Comentario>(0);
	private Set<MiembroBmsProtocolo> miembroBmsProtocolos = new HashSet<MiembroBmsProtocolo>(
			0);
	// Constructors

	/** default constructor */
	public MiembroBms() {
	}

	/** minimal constructor */
	public MiembroBms(String email) {
		this.email = email;
	}

	/** full constructor */
	public MiembroBms(String email, String mobilePhone,
			String name, String phone, String surname,
			Set<Comentario> comentarios,
			Set<MiembroBmsProtocolo> miembroBmsProtocolos) {
		this.email = email;
		this.mobilePhone = mobilePhone;
		this.name = name;
		this.phone = phone;
		this.surname = surname;
		this.comentarios = comentarios;
		this.miembroBmsProtocolos = miembroBmsProtocolos;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "email", unique = true, nullable = false)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "mobilePhone")
	public String getMobilePhone() {
		return this.mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "phone")
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "surname")
	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

    @Column(name = "dni")
    public String getDni() {
        return this.dni;
    }

    public void setDni(String dni) {
        this.dni = dni;
    }

    @Column(name = "eclipseId")
    public String getEclipseId() {
        return this.eclipseId;
    }

    public void setEclipseId(String eclipseId) {
        this.eclipseId = eclipseId;
    }

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "miembroBms")
	public Set<Comentario> getComentarios() {
		return this.comentarios;
	}

	public void setComentarios(Set<Comentario> comentarios) {
		this.comentarios = comentarios;
	}

	@OneToMany(fetch = FetchType.EAGER, mappedBy = "miembroBms")
	public Set<MiembroBmsProtocolo> getMiembroBmsProtocolos() {
		return this.miembroBmsProtocolos;
	}

	public void setMiembroBmsProtocolos(
			Set<MiembroBmsProtocolo> miembroBmsProtocolos) {
		this.miembroBmsProtocolos = miembroBmsProtocolos;
	}

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "roleid", nullable = false)
    public Role getRole() {
        return this.role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @Column(name = "projectlead")
    public boolean getProjectLead() {
        return projectLead;
    }

    public void setProjectLead(boolean projectLead) {
        this.projectLead = projectLead;
    }

    @Column(name = "unboundedmonitor")
    public boolean getUnboundedMonitor() {
        return unboundedMonitor;
    }

    public void setUnboundedMonitor(boolean unboundedMonitor) {
        this.unboundedMonitor = unboundedMonitor;
    }

    @Column(name = "bmsId")
    public String getBmsId() {
        return bmsId;
    }

    public void setBmsId(String bmsId) {
        this.bmsId = bmsId;
    }

}
